package com.cn.client;


import com.cn.client.controller.OrderController;
import com.cn.client.vo.orderAndVisitorVo.GenerateOrder;
import org.hibernate.validator.constraints.SafeHtml;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.IOException;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderText {
    @Autowired
    private OrderController orderController;
//    @Test
//    public void test() throws IOException {
//        System.out.println(orderController.findScenicInformation(1));
////        while(true){
////
////        }
//    }

    @Test
    //根据订单号查询订单
    public void  test1(){
        orderController.findByOrderNumber("111647485660554");
    }

    @Test
    //未支付取消订单
    public void  test2(){
        orderController.cancelOrder("111647485660554");
    }

    @Test
    //生成订单
    public void  test3(){
        GenerateOrder generateOrder=new GenerateOrder();
        generateOrder.setUserId(1);
        generateOrder.setAdultQuantity(1);
        generateOrder.setChildrenQuantity(1);
        SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
        generateOrder.setTravelTime(dateformat.format(new Date()));
        List list=new ArrayList();
        list.add(1);
        generateOrder.setVisitorId(list);
        generateOrder.setCouponId(1);
        generateOrder.setProductId(1);
        orderController.generateOrder(generateOrder);
    }

    @Test
    public void  test4(){
        orderController.generateCode("111647485660554","25");
    }


}
